<?php

/**
 * Systemweite Konstanten
 *
 */

// Debug
if (!defined('WSB_DEBUG')) {
	define('WSB_DEBUG', false);
}

// Pfade
if (!defined('WSB_HOST')) {
	define('WSB_HOST', $_SERVER['HTTP_HOST']); // WITHOUT trailing slash
}
if (!defined('WSB_URL')) {
	//define('WSB_URL', preg_replace('#/admin$#', '', dirname($_SERVER['SCRIPT_NAME'])) . '/'); // With trailing slash
	define('WSB_URL', preg_replace('#/admin$#', '', rtrim(dirname($_SERVER['SCRIPT_NAME']), '/')) . '/'); // With trailing slash
}
if (!defined('WSB_ADMIN_URL')) {
	define('WSB_ADMIN_URL', WSB_URL . 'admin/'); // With trailing slash
}
if (!defined('WSB_PATH')) {
	define('WSB_PATH', preg_replace('#/admin$#', '', dirname($_SERVER['SCRIPT_FILENAME'])) . '/'); // With trailing slash
}
if (!defined('WSB_ADMIN_PATH')) {
	define('WSB_ADMIN_PATH', WSB_PATH . 'admin/'); // With trailing slash
}
if (!defined('WSB_APP_PATH')) {
	define('WSB_APP_PATH', substr(dirname(__FILE__), 0, -3)); // With trailing slash
}
if (!defined('WSB_IS_ADMIN_MODE')) {
	define('WSB_IS_ADMIN_MODE', (strpos($_SERVER['REQUEST_URI'], 'admin') === false) ? false : true); // Frontend = 0, Admin = 1
}

define('WSB_MODULES_PATH', WSB_APP_PATH . 'modules/');
define('WSB_XTENSION_PATH', WSB_APP_PATH . 'xtensions/');
define('WSB_CACHE_DIR', WSB_APP_PATH . 'tmp/cache/');


// Version
define('WSB_ZEND_FRAMEWORK_VERSION', '1.9.5');

// Buttons
define('WSB_BTN_SAVE', 'SAVE');
define('WSB_BTN_SAVE_CLOSE', 'SAVE_CLOSE');
define('WSB_BTN_CANCEL', 'CANCEL');
define('WSB_BTN_DELETE', 'DELETE');

// ACL
define('WSB_ACL_ROLE_ADMIN', 'ADMIN');
define('WSB_ACL_ROLE_STAFF', 'STAFF');

/*
foreach(get_defined_constants() AS $key=>$value) {
    if(substr($key, 0, 4) == 'WSB_') {
        echo sprintf('%s => %s<br />', $key, $value);
    }
}
*/
